/**
 * 
 */
package com.mobipe.sutto.serverlogic;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;



/**
 * @author kohachiro
 *
 */
public class Room {

	final int id;
	final String name;
	final Map<String, String> properties;
	final Map<Integer, User> players;
	final Map<Integer, Rectangular> rectangular;
	int[] from;
	int[] to;
	int maxUsers;
	User owner;
	String password;	
	boolean isLocked;
	/**
	 * 
	 */
	public Room(int id,String name) {
		this.id=id;
		this.name=name;
		players= new ConcurrentHashMap<Integer, User>();		
		properties = new ConcurrentHashMap<String, String>();		
		rectangular= new ConcurrentHashMap<Integer, Rectangular>();
	}
	public boolean isLocked() {
		return isLocked;
	}
	public void setLocked(boolean isLocked) {
		this.isLocked = isLocked;
	}
	public int[] getFrom() {
		return from;
	}
	public void setFrom(int[] from) {
		this.from = from;
	}
	public int[] getTo() {
		return to;
	}
	public void setTo(int[] to) {
		this.to = to;
	}
	public void setMaxUsers(int maxUsers) {
		this.maxUsers = maxUsers;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setOwner(User owner) {
		this.owner = owner;
	}	
	
	public int getId() {
		return id;
	}
	public String getName() {
		return name;
	}
	public Map<String, String> getProperties() {
		return properties;
	}
	public void addProperty(String key,String value) {
		properties.put(key, value);
	}
	public String getProperty(String key) {
		return properties.get(key);
	}	
	public void removeProperty(String key) {
		properties.remove(key);
	}		
	public Map<Integer, User> getPlayerList() {
		return players;
	}
	public int getUserNumber() {
		return players.size();
	}	
	public int getMaxUsers() {
		return maxUsers;
	}
	public User getUser(int userID) {
		return players.get(userID);
	}
	public String getPassword() {
		return password;
	}	
	public User getOwner() {
		return owner;
	}
}
